import sys

sys.path.append('/Users/xuchaosheng/anaconda3/lib/python3.6/site-packages')
sys.path.append('simulator')
sys.path.append('./')

from gevent import monkey

monkey.patch_all()

from flask import Flask, session, redirect, url_for, escape, request
from flask import request, jsonify, send_from_directory, abort
from flask import render_template
from flask import make_response
from datetime import timedelta
from pymongo import MongoClient
from simulator import zhilian
from bson import ObjectId
from flask import url_for

try:
    from gevent.wsgi import WSGIServer
except:
    from gevent.pywsgi import WSGIServer

import jieba.posseg as pseg
import numpy as np
import difflib
import datetime
import pymongo
import random
import gensim
import pprint
import socket
import jieba
import time
import json
import sys
import os
import re

app = Flask(__name__)
app.secret_key = 'HANGZHOUQUSHUWANGLUOKEJI'
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = timedelta(seconds = 1)

# client = MongoClient('47.96.88.18', 27017, connect = False)
client = MongoClient('127.0.0.1', 27017, connect = False)

itjuzi_db = client['itjuzi_db']
itjuzi_coll = itjuzi_db['itjuzi_coll']

# 匹配数据库
qushu_resume_db = client['qushu_resume_db']
qushu_resume_coll = qushu_resume_db['qushu_resume_coll']

# 获取联系方式的库
qushu_contact_db = client['qushu_contact_db']
qushu_contact_coll = qushu_contact_db['qushu_contact_coll']

# 用户数据库
qushu_cv_match_user_db = client['qushu_cv_match_user_db']
qushu_cv_match_user_coll = qushu_cv_match_user_db['qushu_cv_match_user_coll']

school_985_211 = []

with open('static/985.txt', 'r', encoding = 'utf-8') as file:
    school_985_211 += [i.strip() for i in file.readlines() if i.strip() not in school_985_211]

with open('static/211.txt', 'r', encoding = 'utf-8') as file:
    school_985_211 += [i.strip() for i in file.readlines() if i.strip() not in school_985_211]

with open('static/china-famous-college.txt', 'r', encoding = 'utf-8') as file:
    school_985_211 += [i.strip() for i in file.readlines() if i.strip() not in school_985_211]

with open('static/world-famous-college.txt', 'r', encoding = 'utf-8') as file:
    school_985_211 += [i.strip() for i in file.readlines() if i.strip() not in school_985_211]

# school_985_211 = school_985 + school_211
